package com.hsmw.api.service;


import cn.hutool.core.collection.CollectionUtil;
import com.aliyun.dyvmsapi20170525.models.SingleCallByVoiceResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hsmw.api.config.jwt.CurrentHsmwUserUtils;
import com.hsmw.api.config.jwt.LoginUser;
import com.hsmw.api.controller.pub.TencentPushUtils;
import com.hsmw.api.controller.pub.WebSocket;
import com.hsmw.api.mapper.*;
import com.hsmw.api.task.Sample;
import com.hsmw.api.utils.GaoDeInfoUtils;
import com.hsmw.api.vo.*;
import com.hsmw.common.base.BaseService;
import com.htn.common.core.base.DataResponse;
import com.htn.common.core.constant.*;
import com.hsmw.api.utils.CommonUtils;
import com.htn.common.core.utils.StringUtils;
import com.hsmw.domain.*;
import com.hsmw.domain.vo.DriverUserVO;
import com.hsmw.domain.vo.GpsInfoEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;

@Slf4j
@Service
@Transactional(isolation = Isolation.REPEATABLE_READ, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class HsmwReportService extends BaseService<HsmwReportMapper, HsmwReport> {


    @Autowired
    private HsmwReportMapper hsmwReportMapper;

    @Autowired
    private HsmwPictureService hsmwPictureService;

    @Autowired
    private CurrentHsmwUserUtils currentHsmwUserUtils;

    @Autowired
    private HsmwUserDriverMapper hsmwUserDriverMapper;

    @Autowired
    private HsmwReportRecordMapper hsmwReportRecordMapper;

    @Autowired
    private HsmwVehicleMapper hsmwVehicleMapper;

    @Autowired
    private HsmwOrderVehicleRelationMapper hsmwOrderVehicleRelationMapper;

    @Autowired
    private HsmwItemMapper hsmwItemMapper;

    @Autowired
    private HsmwOrderVehicleRequestService hsmwOrderVehicleRequestService;


    @Autowired
    private HsmwHtnUserService hsmwHtnUserService;

    @Autowired
    private WebSocket webSocket;

    @Autowired
    private HsmwPushInfoService hsmwPushInfoService;

    @Autowired
    private HsmwDriverNewsService hsmwDriverNewsService;

    @Autowired
    private HsmwScoringRecordMapper hsmwScoringRecordMapper;

    @Autowired
    private HsmwDriverComplaintsMapper hsmwDriverComplaintsMapper;


    @Autowired
    private HsmwReportInfoMapper hsmwReportInfoMapper;

    @Autowired
    private HsmwOrderService hsmwOrderService;

    @Autowired
    private HsmwTpspUserService hsmwTpspUserService;

    @Autowired
    private HsmwDriverUserService hsmwDriverUserService;




    @Value(value = "${sms.appKey}")
    private String appKey;
    @Value(value = "${sms.channel}")
    private String channel;
    @Value(value = "${sms.smsSign}")
    private String smsSign;
    @Value(value = "${sms.appId}")
    private int appId;
    @Value(value = "${sms.driverOrderCanceled}")
    private int driverOrderCanceled;



    final static String voiceCode = "7f9bd21e-bc53-4955-8777-f641f82b3ec7.wav";

    final static  Long queryTime = 3L;

    /**
     * 新增或者修改上报内容
     *
     * @param hsmwReport
     */
    public void reportSaveOrUpdate(HsmwReport hsmwReport) {
        LoginUser currentHsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
        if (StringUtils.isNotBlank(hsmwReport.getId())) {
            HsmwReportRecord hsmwReportRecord = hsmwReport.getHsmwReportRecord();
            hsmwReportRecord.setReportId(hsmwReport.getId());
            hsmwReportRecord.setReportStatus(hsmwReport.getExamineType());
            HsmwReport report = hsmwReportMapper.selectById(hsmwReport.getId());
            if (report != null) {
                //开始解决
                if(hsmwReport.getExamineType().equals("0")){
                    hsmwReportRecord.setReceiverName(currentHsmwUser.getName());
                    hsmwReportRecord.setReceiverPhone(currentHsmwUser.getUsername());
                    hsmwReportRecord.setReceiverDeptName("默认");
                    hsmwReportRecord.setStartTime(LocalDateTime.now());
                }
                // 解决
                if (hsmwReport.getExamineType().equals("2")) {
                    hsmwReportRecord.setReceiverName(currentHsmwUser.getName());
                    hsmwReportRecord.setReceiverDeptName("默认");
                    hsmwReportRecord.setReceiverPhone(currentHsmwUser.getUsername());
                    hsmwReportRecord.setSolveTime(LocalDateTime.now());
                    hsmwReportRecord.setReceiverId(currentHsmwUser.getId());
                    hsmwReportRecord.setCloseContent("未评价");
                    /*//上报司机id
                    String driId = report.getDriId();
                    // 根据上报信息中的司机id 查询司机的信息
                    HsmwUserDriver userDriver = hsmwUserDriverMapper.selectById(driId);
                    HsmwScoringRecord scoringRecord = new HsmwScoringRecord();
                    if(StringUtils.equals("2",report.getReportType())){
                        scoringRecord.setInitialScore(userDriver.getScore());
                        scoringRecord.setRemark("车辆故障-10");
                        scoringRecord.setFluctuateScore("-10");
                        scoringRecord.setDriverId(driId);
                        scoringRecord.setEndScore(String.valueOf(Long.parseLong(userDriver.getScore()) - 10));
                        userDriver.setScore(String.valueOf(Long.parseLong(userDriver.getScore()) - 10));
                    }
                    if(StringUtils.equals("3",report.getReportType())){
                        scoringRecord.setInitialScore(userDriver.getScore());
                        scoringRecord.setDriverId(driId);
                        scoringRecord.setRemark("交通事故-50");
                        scoringRecord.setFluctuateScore("-50");
                        scoringRecord.setEndScore(String.valueOf(Long.parseLong(userDriver.getScore()) - 50));
                        userDriver.setScore(String.valueOf(Long.parseLong(userDriver.getScore()) - 50));
                    }
                    hsmwScoringRecordMapper.insert(scoringRecord);
                    hsmwUserDriverMapper.updateById(userDriver);*/


                }
                // 回访
                if (hsmwReport.getExamineType().equals("3")) {
                    hsmwReportRecord.setVisitTime(LocalDateTime.now());
                    String driId = hsmwReport.getDriId();
                    if (StringUtils.isNotBlank(driId)) {
                        HsmwUserDriver userDriver = hsmwUserDriverMapper.selectById(driId);
                        if (StringUtils.isNotBlank(userDriver.getUserId())) {
                            HsmwDriverUser user = hsmwDriverUserService.getById(userDriver.getUserId());
                            if (StringUtils.isNotBlank(user.getUsername())) {
                                //回访成功之后 发送推送给司机
                                String msg = "您上报的问题已经被受理，请耐心等待平台处理!";
                                //对APP进行离线推送
                                TencentPushUtils.pushMsg(msg, user.getUsername(), "has_new_message");
                                HsmwDriverNews hsmwDriverNews = new HsmwDriverNews();
                                hsmwDriverNews.setAlreadyRead("0");
                                hsmwDriverNews.setMessage(msg);
                                hsmwDriverNews.setUserId(userDriver.getUserId());
                                hsmwDriverNewsService.save(hsmwDriverNews);
                            }
                        }
                    }

                }
                //关闭
                if (hsmwReport.getExamineType().equals("4")) {
                    hsmwReportRecord.setCloseTime(LocalDateTime.now());
                }
            }
            hsmwReportMapper.updateById(hsmwReport);
            hsmwReportRecordMapper.insert(hsmwReportRecord);

            if (CollectionUtil.isNotEmpty(hsmwReport.getPicList())) {
                List<HsmwPicture> pictures = new ArrayList<>();
                List<HashMap> picList = hsmwReport.getPicList();
                if (null != picList && picList.size() > 0) {
                    for (HashMap<String, String> pic : picList) {
                        HsmwPicture temp = new HsmwPicture();
                        temp.setPicPath(pic.get("picPath"));
                        temp.setPicRealPath(pic.get("realPath"));
                        temp.setPortId(hsmwReport.getId());
                        temp.setCreateTime(LocalDateTime.now());
                        temp.setPicType(PicTypeEnum.REPORT_IMAGER.getValue());
                        pictures.add(temp);
                    }
                }
                hsmwPictureService.saveBatch(pictures);
            }
            if (CollectionUtil.isNotEmpty(hsmwReportRecord.getPicList())) {
                List<HsmwPicture> pictures = new ArrayList<>();
                List<HashMap> picList = hsmwReportRecord.getPicList();
                if (null != picList && picList.size() > 0) {
                    for (HashMap<String, String> pic : picList) {
                        HsmwPicture temp = new HsmwPicture();
                        temp.setPicPath(pic.get("picPath"));
                        temp.setPicRealPath(pic.get("realPath"));
                        temp.setPortId(hsmwReportRecord.getId());
                        temp.setCreateTime(LocalDateTime.now());
                        temp.setPicType(PicTypeEnum.REPORT_RECORD_IMAGE.getValue());
                        pictures.add(temp);
                    }
                }
                hsmwPictureService.saveBatch(pictures);
            }
        } else {
            LoginUser hsmwUser = currentHsmwUserUtils.getCurrentUserInfo();
            if (hsmwUser != null) {
                hsmwReport.setReportName(hsmwUser.getName());
                hsmwReport.setReportPhone(hsmwUser.getUsername());
                hsmwReport.setCreateUser(hsmwUser.getId());
                hsmwReport.setCreateTime(LocalDateTime.now());
            }
            String driId = hsmwReport.getDriId();
            HsmwUserDriver hsmwUserDriver = hsmwUserDriverMapper.selectById(driId);
            // 通过车辆id  查询租赁公司信息
            String vehicleId = hsmwUserDriver.getVehicleId();
            HsmwVehicle hsmwVehicle = hsmwVehicleMapper.selectById(vehicleId);
            hsmwReport.setUpdateTime(LocalDateTime.now());
            hsmwReport.setVehicleId(hsmwUserDriver.getVehicleId());
            hsmwReport.setExamineType("1");
            hsmwReport.setCompanyId(hsmwVehicle.getLeasingCompanyId());
            String reportId = CommonUtils.generateId(hsmwReport);
            hsmwReport.setId(reportId);
            hsmwReportMapper.insert(hsmwReport);

            HsmwReportInfo reportInfo = new HsmwReportInfo();
            reportInfo.setReportId(reportId);
            reportInfo.setReportType(hsmwReport.getReportType());
            reportInfo.setName(currentHsmwUser.getName());
            reportInfo.setUserId(currentHsmwUser.getId());
            reportInfo.setReadFlag(false);
            hsmwReportInfoMapper.insert(reportInfo);
            if(StringUtils.equals("2",hsmwReport.getReportType()) || StringUtils.equals("3",hsmwReport.getReportType()) || StringUtils.equals("5",hsmwReport.getReportType())){
                if(StringUtils.equals("2",hsmwReport.getOrderStatus()) || StringUtils.equals("3",hsmwReport.getOrderStatus())){
                    String msg = null;
                    if(StringUtils.equals("2",hsmwReport.getReportType())){
                        msg = "很抱歉，司机遇到车辆故障，订单将被延误,您是否需要取消订单再来一单！";
                    }else if(StringUtils.equals("3",hsmwReport.getReportType())){
                        msg = "很抱歉，司机遇到事故问题，订单将被延误,您是否需要取消订单再来一单！";
                    }else {
                        msg = "很抱歉，司机遇到轮胎问题，订单将被延误,您是否需要取消订单再来一单！";
                    }
                    if(StringUtils.isNotBlank(hsmwReport.getOrderId())){
                        HsmwOrder order = hsmwOrderService.getById(hsmwReport.getOrderId());
                        if(StringUtils.isNotBlank(order.getCreateUser())){
                            HsmwHtnUser user = hsmwHtnUserService.getById(order.getCreateUser());
                            if(null != user){
                                HsmwPushInfo hsmwPushInfo = new HsmwPushInfo();
                                hsmwPushInfo.setOrderId(order.getId());
                                hsmwPushInfo.setMessage(msg);
                                hsmwPushInfo.setRelationId(hsmwReport.getRelationId());
                                hsmwPushInfo.setType("DRIVER_REPORT");
                                hsmwPushInfo.setReportId(reportId);
                                hsmwPushInfoService.save(hsmwPushInfo);
                                WebSocketReturnVO webSocketReturnVO = new WebSocketReturnVO();
                                webSocketReturnVO.setPushId(hsmwPushInfo.getId());
                                webSocketReturnVO.setReportId(reportId);
                                webSocketReturnVO.setOrderId(order.getId());
                                webSocketReturnVO.setStatus(order.getIfConcreteRequired());
                                webSocketReturnVO.setMessage(msg);
                                webSocketReturnVO.setRelationId(hsmwReport.getRelationId());
                                TencentPushUtils.selfrunCanCelMsg(msg,user.getUsername(),"has_new_message",webSocketReturnVO);
                                HsmwDriverNews hsmwDriverNews = new HsmwDriverNews();
                                hsmwDriverNews.setUserId(user.getId());
                                hsmwDriverNews.setMessage(msg);
                                hsmwDriverNews.setAlreadyRead("0");
                                hsmwDriverNewsService.save(hsmwDriverNews);
                            }
                        }
                    }
                }
            }
            //确认
            if (hsmwReport.getExamineType().equals("1")) { //修理厂 车辆维修
                if (hsmwReport.getReportType().equals("2")) {
                    List<HsmwTpspUser> tpsp = hsmwTpspUserService.list(new LambdaQueryWrapper<HsmwTpspUser>().eq(HsmwTpspUser::getType, "TPSP").eq(HsmwTpspUser::getTpspType, "1").eq(HsmwTpspUser::getOwnCompanyId,hsmwVehicle.getLeasingCompanyId()));
                    for (HsmwTpspUser user : tpsp) {
                        try {
                            SingleCallByVoiceResponse singleCallByVoiceResponse = Sample.SingleCallByVoice(Sample.createDyvmsapiClient(), user.getUsername(), voiceCode);
                            Sample.QueryCallDetailByCallId(Sample.createDyvmsapiClient(), singleCallByVoiceResponse.body.callId, queryTime);

                            //SingleCallByVoiceResponse response = Sample.SingleCallByVoice(Sample.createDyvmsapiClient(), "18722575155", voiceCode);
                            //Sample.QueryCallDetailByCallId(Sample.createDyvmsapiClient(), response.body.callId, queryTime);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }

                if (hsmwReport.getReportType().equals("3") || hsmwReport.getReportType().equals("5")) { // 小叔 事故 轮胎
                    List<HsmwTpspUser> tpsp = hsmwTpspUserService.list(new LambdaQueryWrapper<HsmwTpspUser>().eq(HsmwTpspUser::getType, "TPSP").eq(HsmwTpspUser::getTpspType, "2").eq(HsmwTpspUser::getOwnCompanyId,hsmwVehicle.getLeasingCompanyId()));
                    for (HsmwUser user : tpsp) {
                        try {
                            SingleCallByVoiceResponse singleCallByVoiceResponse = Sample.SingleCallByVoice(Sample.createDyvmsapiClient(), user.getUsername(), voiceCode);
                            Sample.QueryCallDetailByCallId(Sample.createDyvmsapiClient(), singleCallByVoiceResponse.body.callId, queryTime);
                            //SingleCallByVoiceResponse response = Sample.SingleCallByVoice(Sample.createDyvmsapiClient(), "18722575155", voiceCode);
                            //Sample.QueryCallDetailByCallId(Sample.createDyvmsapiClient(), response.body.callId, queryTime);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
                if (hsmwReport.getReportType().equals("4")) { // 李宁 安全作业
                    List<HsmwTpspUser> tpsp = hsmwTpspUserService.list(new LambdaQueryWrapper<HsmwTpspUser>().eq(HsmwTpspUser::getType, "TPSP").eq(HsmwTpspUser::getTpspType, "3").eq(HsmwTpspUser::getOwnCompanyId,hsmwVehicle.getLeasingCompanyId()));
                    for (HsmwUser user : tpsp) {
                        try {
                            SingleCallByVoiceResponse singleCallByVoiceResponse = Sample.SingleCallByVoice(Sample.createDyvmsapiClient(), user.getUsername(), voiceCode);
                            Sample.QueryCallDetailByCallId(Sample.createDyvmsapiClient(), singleCallByVoiceResponse.body.callId, queryTime);
                            //SingleCallByVoiceResponse response = Sample.SingleCallByVoice(Sample.createDyvmsapiClient(), "18722575155", voiceCode);
                           // Sample.QueryCallDetailByCallId(Sample.createDyvmsapiClient(), response.body.callId, queryTime);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
                if (hsmwReport.getReportType().equals("6")) { // 潘总 泵管
                    List<HsmwTpspUser> tpsp = hsmwTpspUserService.list(new LambdaQueryWrapper<HsmwTpspUser>().eq(HsmwTpspUser::getType, "TPSP").eq(HsmwTpspUser::getTpspType, "4").eq(HsmwTpspUser::getOwnCompanyId,hsmwVehicle.getLeasingCompanyId()));
                    for (HsmwUser user : tpsp) {
                        try {
                            SingleCallByVoiceResponse singleCallByVoiceResponse = Sample.SingleCallByVoice(Sample.createDyvmsapiClient(), user.getUsername(), voiceCode);
                            Sample.QueryCallDetailByCallId(Sample.createDyvmsapiClient(), singleCallByVoiceResponse.body.callId, queryTime);
                           // SingleCallByVoiceResponse response = Sample.SingleCallByVoice(Sample.createDyvmsapiClient(), "18722575155", voiceCode);
                           // Sample.QueryCallDetailByCallId(Sample.createDyvmsapiClient(), response.body.callId, queryTime);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }
            if (CollectionUtil.isNotEmpty(hsmwReport.getPicList())) {
                System.err.println(hsmwReport.getPicList());
                List<HsmwPicture> pictures = new ArrayList<>();
                List<HashMap> picList = hsmwReport.getPicList();
                if (null != picList && picList.size() > 0) {
                    for (HashMap<String, String> pic : picList) {
                        HsmwPicture temp = new HsmwPicture();
                        temp.setPicPath(pic.get("picPath"));
                        temp.setPicRealPath(pic.get("realPath"));
                        temp.setPortId(hsmwReport.getId());
                        temp.setCreateTime(LocalDateTime.now());
                        temp.setPicType(PicTypeEnum.REPORT_IMAGER.getValue());
                        pictures.add(temp);
                    }
                }
                hsmwPictureService.saveBatch(pictures);
            }
        }

    }


    /**
     * 查询上报信息列表
     *
     * @param page
     * @param hsmwReport
     * @return
     */
    public IPage<HsmwReport> findReportListInfo(IPage page, HsmwReport hsmwReport) {
        LambdaQueryWrapper<HsmwReport> lambdaQuery = Wrappers.lambdaQuery(HsmwReport.class);
        if (hsmwReport != null) {
            if (StringUtils.isNotBlank(hsmwReport.getExamineType())) {
                lambdaQuery.in(HsmwReport::getExamineType, hsmwReport.getExamineType());
            }
            if (StringUtils.isNotBlank(hsmwReport.getReportType())) {
                String reportType = hsmwReport.getReportType();
                String[] arr = reportType.split(",");
                lambdaQuery.in(HsmwReport::getReportType, arr);
            }
            if (null != (hsmwReport.getCreateTime())) {
                LocalDateTime createTime = hsmwReport.getCreateTime();
                LocalDateTime tomDay = createTime.plusDays(1L);
                lambdaQuery.gt(HsmwReport::getCreateTime, hsmwReport.getCreateTime()).lt(HsmwReport::getCreateTime, tomDay);
            }
            if (StringUtils.isNotBlank(hsmwReport.getDriId())) {
                lambdaQuery.eq(HsmwReport::getDriId, hsmwReport.getDriId());
            }
            if (StringUtils.isNotBlank(hsmwReport.getReportName())) {
                lambdaQuery.like(HsmwReport::getReportName, hsmwReport.getReportName());
            }
            if (StringUtils.isNotBlank(hsmwReport.getReportPhone())) {
                lambdaQuery.like(HsmwReport::getReportPhone, hsmwReport.getReportPhone());
            }
            if (StringUtils.isNotBlank(hsmwReport.getVehicleId())) {
                lambdaQuery.eq(HsmwReport::getVehicleId, hsmwReport.getVehicleId());
            }
        }
        lambdaQuery.orderByDesc(HsmwReport::getCreateTime);
        IPage<HsmwReport> orderIPage = hsmwReportMapper.selectPage(page, lambdaQuery);
        return orderIPage;
    }

    /**
     * 根据id查询上报信息
     *
     * @param reportId
     * @return
     */
    public HsmwReport findReportInfoById(String reportId) {

        HsmwReport hsmwReport = hsmwReportMapper.selectById(reportId);
        Map map = new HashMap();
        List<HsmwPicture> list = hsmwPictureService.list(new LambdaQueryWrapper<HsmwPicture>().eq(HsmwPicture::getPortId, reportId));
        if (CollectionUtil.isNotEmpty(list)) {

            hsmwReport.setHsmwPictures(list);
        }
        String vehicleId = hsmwReport.getVehicleId();
        HsmwVehicle hsmwVehicle = hsmwVehicleMapper.selectById(vehicleId);
        hsmwReport.setVehicleNum(hsmwVehicle.getVehiclePlate());

        List<HsmwOrderVehicleRelation> hsmwOrderVehicleRelation = hsmwOrderVehicleRelationMapper.selectList(new LambdaQueryWrapper<HsmwOrderVehicleRelation>().eq(HsmwOrderVehicleRelation::getVehicleId, vehicleId).in(HsmwOrderVehicleRelation::getOrderId, "2", "3", "4", "5", "6"));
        if (CollectionUtil.isEmpty(hsmwOrderVehicleRelation)) {
            hsmwReport.setIfOrder("否");
        } else {
            hsmwReport.setIfOrder("是");
        }

        List<HsmwReportRecord> hsmwReportRecords = hsmwReportRecordMapper.selectList(new LambdaQueryWrapper<HsmwReportRecord>().eq(HsmwReportRecord::getReportId, reportId));
        hsmwReport.setHsmwReportRecords(hsmwReportRecords);

        return hsmwReport;
    }

    public HsmwReport findReportInfoByDriverId(String id) {

        HsmwReport hsmwReport = hsmwReportMapper.selectOne(new LambdaQueryWrapper<HsmwReport>().eq(HsmwReport::getDriId, id).eq(HsmwReport::getReportType, "1").eq(HsmwReport::getExamineType, "1").orderByDesc(HsmwReport::getCreateTime).last("LIMIT 1"));
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");
        String format = formatter.format(hsmwReport.getStartTime());
        String format1 = formatter.format(hsmwReport.getEndTime());
        hsmwReport.setStartDateFormatterTime(format);
        hsmwReport.setEndDateFormatterTime(format1);
        return hsmwReport;
    }

    public HsmwReport findReportNewInfoByDriverId(String id) {

        return hsmwReportMapper.selectOne(new LambdaQueryWrapper<HsmwReport>().eq(HsmwReport::getDriId, id).eq(HsmwReport::getExamineType, "1").orderByDesc(HsmwReport::getCreateTime).last("LIMIT 1"));
    }

    /**
     * 查询第三方 待解决列表信息
     *
     * @return
     */
    public List<HsmwReport> findReportToSolveStatusList(String name, String exType) {

        LambdaQueryWrapper<HsmwReport> queryWrapper2 = new QueryWrapper<HsmwReport>().lambda();

        LoginUser loginUser = currentHsmwUserUtils.getCurrentUserInfo();
        HsmwTpspUser currentHsmwUser = hsmwTpspUserService.getById(loginUser.getId());

        if (StringUtils.equals("1", exType)) {
            if (StringUtils.isNotBlank(currentHsmwUser.getTpspType())) {
                if (StringUtils.equals("1", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .eq(HsmwReport::getExamineType, exType)
                            .in(HsmwReport::getReportType, "2")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("2", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .eq(HsmwReport::getExamineType, exType)
                            .in(HsmwReport::getReportType, "3", "5")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("3", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .eq(HsmwReport::getExamineType, exType)
                            .in(HsmwReport::getReportType, "4")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("4", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .eq(HsmwReport::getExamineType, exType)
                            .in(HsmwReport::getReportType, "6")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
            }
        } else if (StringUtils.equals("2", exType)) {
            if (StringUtils.isNotBlank(currentHsmwUser.getTpspType())) {
                if (StringUtils.equals("1", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .in(HsmwReport::getExamineType, "2", "3")
                            .in(HsmwReport::getReportType, "2")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("2", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .in(HsmwReport::getExamineType, "2", "3")
                            .in(HsmwReport::getReportType, "3", "5")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("3", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .in(HsmwReport::getExamineType, "2", "3")
                            .in(HsmwReport::getReportType, "4")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("4", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .in(HsmwReport::getExamineType, "2", "3")
                            .in(HsmwReport::getReportType, "6")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
            }
        } else {
            if (StringUtils.isNotBlank(currentHsmwUser.getTpspType())) {
                if (StringUtils.equals("1", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .in(HsmwReport::getExamineType, "0")
                            .in(HsmwReport::getReportType, "2")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("2", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .in(HsmwReport::getExamineType, "0")
                            .in(HsmwReport::getReportType, "3", "5")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("3", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .in(HsmwReport::getExamineType, "0")
                            .in(HsmwReport::getReportType, "4")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
                if (StringUtils.equals("4", currentHsmwUser.getTpspType())) {
                    queryWrapper2
                            .in(HsmwReport::getExamineType, "0")
                            .in(HsmwReport::getReportType, "6")
                            .eq(HsmwReport::getCompanyId, currentHsmwUser.getOwnCompanyId())
                            .orderByDesc(HsmwReport::getCreateTime);
                }
            }
        }
        if (StringUtils.isNotBlank(name)) {
            queryWrapper2.and(wrapper -> wrapper.like(HsmwReport::getReportName, name).or().like(HsmwReport::getReportPhone, name));
        }

        return hsmwReportMapper.selectList(queryWrapper2);
    }


    public HsmwReport findReportInfoByRepostId(String reId, String exType) {

        HsmwReport hsmwReport = hsmwReportMapper.selectById(reId);
        if (hsmwReport != null) {
            String vehicleId = hsmwReport.getVehicleId();
            HsmwVehicle hsmwVehicle = hsmwVehicleMapper.selectById(vehicleId);
            hsmwReport.setVehicleNum(hsmwVehicle.getVehiclePlate());
            hsmwReport.setVehicleType(hsmwVehicle.getVehicleType());
            // 地址
            if (StringUtils.isNotBlank(hsmwVehicle.getImeiNum()) || StringUtils.isNotBlank(hsmwVehicle.getIdentifyingCode())) {
                GpsInfoEntity entity = GaoDeInfoUtils.getSingleVehicleGpsLocate(hsmwVehicle.getImeiNum(),hsmwVehicle.getFlag(),hsmwVehicle.getIdentifyingCode());
                if (StringUtils.isNotNull(entity) && StringUtils.isNotBlank(entity.getGpsLon())) {
                    hsmwVehicle.setImeiNumLocate(entity.getGpsLon() + "," + entity.getGpsLat());
                    hsmwReport.setImeiNumLocate(entity.getGpsLon() + "," + entity.getGpsLat());
                }
                if(StringUtils.isNotBlank(hsmwVehicle.getImeiNumLocate())){
                    String nameByGps = GaoDeInfoUtils.gaodeGetNameByGps(hsmwVehicle.getImeiNumLocate());
                    hsmwReport.setNameByGps(nameByGps);
                }
            }
            // 判断是否工作中
            if(StringUtils.equals(hsmwVehicle.getWorkStatus(),CommonConstants.DRIVER_WORK)){
                hsmwReport.setWorkStatus("是");
            }else {
                hsmwReport.setWorkStatus("否");
            }
            HsmwUserDriver userDriver = hsmwUserDriverMapper.selectById(hsmwReport.getDriId());
            List<HsmwUserDriver> userDrivers = hsmwUserDriverMapper.selectList(new LambdaQueryWrapper<HsmwUserDriver>().eq(HsmwUserDriver::getVehicleId, userDriver.getVehicleId()));
            List<DriverUserVO> driverUsers = new ArrayList<>();
            userDrivers.stream().forEach(hsmwUserDriver -> {
                if(StringUtils.isNotNull(hsmwUserDriver)){
                    DriverUserVO driverUser = hsmwDriverUserService.findDriverUserById(hsmwUserDriver.getUserId());
                    driverUsers.add(driverUser);
                }
            });
            hsmwReport.setDriverUserVOS(driverUsers);
            List<HsmwPicture> list = hsmwPictureService.list(new LambdaQueryWrapper<HsmwPicture>().eq(HsmwPicture::getPortId, reId));
            if (CollectionUtil.isNotEmpty(list)) {
                hsmwReport.setHsmwPictures(list);
            }
        }

        List<HsmwReportRecord> hsmwReportRecords = hsmwReportRecordMapper.selectList(new LambdaQueryWrapper<HsmwReportRecord>().eq(HsmwReportRecord::getReportId, reId).in(HsmwReportRecord::getReportStatus, '1', '2',"0"));
        for (HsmwReportRecord hsmwReportRecord : hsmwReportRecords) {
            List<HsmwPicture> hsmwPictures = hsmwPictureService.list(new LambdaQueryWrapper<HsmwPicture>().eq(HsmwPicture::getPortId, hsmwReportRecord.getId()));
            if(CollectionUtil.isNotEmpty(hsmwPictures)){
                hsmwReportRecord.setHsmwPictures(hsmwPictures);
            }
        }
        hsmwReport.setHsmwReportRecords(hsmwReportRecords);

        return hsmwReport;
    }


    boolean checkIfHasleavingRecord(HashMap param) {
        String vehicleId = param.get("vehicleId").toString();
        AtomicInteger count = new AtomicInteger();
        List<HsmwUserDriver> drivers = hsmwUserDriverMapper.selectList(new LambdaQueryWrapper<HsmwUserDriver>().
                eq(HsmwUserDriver::getVehicleId, vehicleId));
        if (CollectionUtil.isNotEmpty(drivers)) {
            drivers.stream().forEach(hsmwUserDriver -> {
                param.put("driverId", hsmwUserDriver.getId());
                Integer res = hsmwReportMapper.checkDriverHasleavingRecord(param);
                if (res > 0) {
                    count.addAndGet(1);
                }
            });
            if (drivers.size() == count.intValue()) {
                return true;
            }
        }
        return false;
    }


    boolean checkDriverHasleavingRecord(HashMap param) {
        Integer count = hsmwReportMapper.checkDriverHasleavingRecord(param);
        if (count > 0) {
            return true;
        } else {
            return false;
        }
    }

    /**
     * 修改请假状态
     *
     * @param hsmwReport

    public DataResponse updateReportExStatus(HsmwReport hsmwReport) {

        if (StringUtils.isBlank(hsmwReport.getId())) {

            return new DataResponse("参数传递错误");
        }
        HsmwReport report = hsmwReportMapper.selectById(hsmwReport.getId());
        if(hsmwReport.getExamineType().equals("1")){

            // 根据车辆id 查询进行中的订单
            String vehicleId = report.getVehicleId();
            HashMap param = new HashMap();
            param.put("vehicleId", vehicleId);
            List<CurrentOrderInfoVO> orderList = hsmwOrderVehicleRelationMapper.getGoingOrderListByParam(param);

            // 再根据车辆id 去查询司机表信息 如果一辆车下又两个司机 直接同意请假 如果司机数量只有一个 直接取消订单 重新派单
            List<HsmwUserDriver> userDrivers = hsmwUserDriverMapper.selectList(new LambdaQueryWrapper<HsmwUserDriver>().eq(HsmwUserDriver::getVehicleId, vehicleId));
            if (CollectionUtil.isNotEmpty(userDrivers)) {
                if (userDrivers.size() > 1) {
                    // 说明司机至少是两个
                    for (HsmwUserDriver userDriver : userDrivers) {
                        if (userDriver.getId().equals(report.getDriId())) {
                            continue;
                        }
                        if (!StringUtils.equals(userDriver.getWorkStatus(), CommonConstants.DRIVER_WORK)) {
                            // 如果不等于工作中的话 则重新派单
                            this.publicCodes(orderList);
                        }

                    }
                    for (CurrentOrderInfoVO currentOrderInfoVO : orderList) {
                        // 获取子订单id 查询对应的子订单信息
                        String orderVehicleRelationId = currentOrderInfoVO.getOrderVehicleRelationId();
                        HsmwOrderVehicleRelation relation = hsmwOrderVehicleRelationMapper.selectById(orderVehicleRelationId);
                        relation.setOrderStatus(ChildOrderStatusEnum.UNDERREVIEW.getValue());
                        hsmwOrderVehicleRelationMapper.updateById(relation);
                        HsmwHtnUser hsmwUser = hsmwHtnUserService.getById(currentOrderInfoVO.getCreateUser());
                        SendSmsUtil.sendDriverSmsCode(appId, appKey, "",driverOrderCanceled, smsSign, hsmwUser.getUsername());
                    }

                } else {
                    //司机肯定是小于一个
                    publicCodes(orderList);
                }
            }

            if(StringUtils.isNotBlank(report.getDriId())){
                HsmwUserDriver userDriver = hsmwUserDriverMapper.selectById(report.getDriId());
                if(StringUtils.isNotBlank(userDriver.getUserId())){
                    HsmwDriverUser user = hsmwDriverUserService.getById(userDriver.getUserId());
                    if(StringUtils.isNotBlank(user.getUsername())){
                        //回访成功之后 发送推送给司机
                        String msg = "您的请假申请已通过，祝您休息愉快！";
                        //对APP进行离线推送
                        TencentPushUtils.pushMsg(msg,user.getUsername(),"has_new_message");
                        HsmwDriverNews hsmwDriverNews = new HsmwDriverNews();
                        hsmwDriverNews.setAlreadyRead("0");
                        hsmwDriverNews.setMessage(msg);
                        hsmwDriverNews.setUserId(userDriver.getUserId());
                        hsmwDriverNewsService.save(hsmwDriverNews);
                    }
                }
            }

        }else {
            if(StringUtils.isNotBlank(report.getDriId())){
                HsmwUserDriver userDriver = hsmwUserDriverMapper.selectById(report.getDriId());
                if(StringUtils.isNotBlank(userDriver.getUserId())){
                    HsmwDriverUser user = hsmwDriverUserService.getById(userDriver.getUserId());
                    if(StringUtils.isNotBlank(user.getUsername())){
                        //回访成功之后 发送推送给司机
                        String msg = "您的请假申请被拒绝，详细原因请前往APP查看！";
                        //对APP进行离线推送
                        TencentPushUtils.pushMsg(msg,user.getUsername(),"has_new_message");
                        HsmwDriverNews hsmwDriverNews = new HsmwDriverNews();
                        hsmwDriverNews.setAlreadyRead("0");
                        hsmwDriverNews.setMessage(msg);
                        hsmwDriverNews.setUserId(userDriver.getUserId());
                        hsmwDriverNewsService.save(hsmwDriverNews);
                    }
                }
            }
        }

        hsmwReport.setAuditTime(LocalDateTime.now());
        hsmwReportMapper.updateById(hsmwReport);

        return new DataResponse(CommonConstants.ResponseStatus.SUCCESS);
    }


    public void publicCodes(List<CurrentOrderInfoVO> orderList) {


        for (CurrentOrderInfoVO currentOrderInfoVO : orderList) {
            // 需求id
            String orderVehicleRequestId = currentOrderInfoVO.getOrderVehicleRequestId();
            HsmwOrderVehicleRequest orderVehicleRequest = hsmwOrderVehicleRequestService.getById(orderVehicleRequestId);

            // 项目id
            String itemId = currentOrderInfoVO.getItemId();
            // 根据项目id 查询项目的经纬度信息，然后查询车辆信息 找到最近的车辆
            HsmwItem hsmwItem = hsmwItemMapper.selectById(itemId);
            // 获取子订单id 查询对应的子订单信息
            String orderVehicleRelationId = currentOrderInfoVO.getOrderVehicleRelationId();
            HsmwOrderVehicleRelation relation = hsmwOrderVehicleRelationMapper.selectById(orderVehicleRelationId);

            //根据车辆类型 型号 项目所在位置经纬度 查询空闲中的车辆
            QueryFreeParams queryFreeParams = new QueryFreeParams();
            queryFreeParams.setVehicleModel(orderVehicleRequest.getVehicleModel());
            queryFreeParams.setVehicleType(orderVehicleRequest.getVehicleType());

            List<IdleVehicleVo> vehicleVoList = hsmwVehicleMapper.findVehicleList(queryFreeParams);
            if (CollectionUtil.isNotEmpty(vehicleVoList)) {
                List<Map<String, Object>> vehilceList = new ArrayList<>();
                for (IdleVehicleVo hsmwVehicle : vehicleVoList) {
                    String vehicleLocalteInfo = null;
                    String destinationLocateInfo = hsmwItem.getLng() + "," + hsmwItem.getLat();
                    if (com.htn.common.core.utils.StringUtils.isNotBlank(hsmwVehicle.getImeiNum())) {
                        GpsInfoEntity entity = GaoDeInfoUtils.getSingleVehicleGpsLocate(hsmwVehicle.getImeiNum());
                        if (com.htn.common.core.utils.StringUtils.isNotNull(entity) && com.htn.common.core.utils.StringUtils.isNotBlank(entity.getGpsLon())) {
                            vehicleLocalteInfo = entity.getGpsLon() + "," + entity.getGpsLat();
                        }
                    }
                    HashMap calculateParam = new HashMap();
                    calculateParam.put("origin", vehicleLocalteInfo);
                    calculateParam.put("destination", destinationLocateInfo);
                    Long durationTime = GaoDeInfoUtils.calculateDistanceTime(calculateParam);
                    Map map = new HashMap();
                    map.put("time", durationTime);
                    map.put("vehicle", hsmwVehicle);
                    vehilceList.add(map);

                }
                Collections.sort(vehilceList, new Comparator<Map<String, Object>>() {
                    public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                        Integer name1 = Integer.valueOf(o1.get("time").toString());
                        Integer name2 = Integer.valueOf(o2.get("time").toString());
                        return name1.compareTo(name2);
                    }
                });
                Map<String, Object> map = vehilceList.get(0);
                Long time = (Long) map.get("time")/60;
                time = time +10;
                IdleVehicleVo vehicle = (IdleVehicleVo) map.get("vehicle");

                //修改子订单状态
                relation.setOrderStatus(ChildOrderStatusEnum.UNDERREVIEW.getValue());
                hsmwOrderVehicleRelationMapper.updateById(relation);
                HsmwHtnUser hsmwUser = hsmwHtnUserService.getById(currentOrderInfoVO.getCreateUser());
                SendSmsUtil.sendDriverSmsCode(appId, appKey, "",driverOrderCanceled, smsSign, hsmwUser.getUsername());
                String msg = "很抱歉，泵车"+vehicle.getVehiclePlate()+" "+vehicle.getVehicleModel()+" "+vehicle.getVehicleType()+" 司机出现问题，无法为您继续服务,订单已经被取消。" +
                        "系统自动为您匹配最近的车辆，预计"+time+"分钟后可以到达，您是否需要重新下单";
                WebSocketReturnVO vo =new WebSocketReturnVO();
                vo.setStatus(WebsocketTypeEnum.REORDER.getValue());
                vo.setMessage(msg);
                vo.setData(orderVehicleRequest);
                vo.setRemaindSeconds(time);
                HsmwPushInfo hsmwPushInfo = new HsmwPushInfo();
                hsmwPushInfo.setDataInfo(orderVehicleRequest.getId());
                hsmwPushInfo.setMessage(msg);
                hsmwPushInfo.setForemanId(orderVehicleRequest.getCreateUser());
                hsmwPushInfo.setReachTime(time);
                hsmwPushInfo.setStatus("0");
                hsmwPushInfoService.save(hsmwPushInfo);
                vo.setPushId(hsmwPushInfo.getId());
                String  returnJson = JSONObject.toJSON(vo).toString();
                if(hsmwUser != null){
                    webSocket.AppointSending(hsmwUser.getUsername(),returnJson);
                    String msgs = "泵车出现问题，无法继续订单，是否需要系统为您自动派单";
                    TencentPushUtils.pushForeManMsg(msgs,hsmwUser.getUsername(),"has_new_message");
                    TencentPushUtils.selfrunMsg(msgs,hsmwUser.getUsername(),"has_new_message");
                }

            }else {

                //修改子订单状态
                relation.setOrderStatus(ChildOrderStatusEnum.UNDERREVIEW.getValue());
                hsmwOrderVehicleRelationMapper.updateById(relation);

                HsmwHtnUser hsmwUser = hsmwHtnUserService.getById(currentOrderInfoVO.getCreateUser());
                SendSmsUtil.sendDriverSmsCode(appId, appKey, "",driverOrderCanceled, smsSign, hsmwUser.getUsername());
                String msg = "很抱歉，泵车出现问题，现在暂无可用车辆，请知晓";
                WebSocketReturnVO vo =new WebSocketReturnVO();
                vo.setStatus(WebsocketTypeEnum.REORDER.getValue());
                vo.setMessage(msg);
                vo.setData(orderVehicleRequest);
                vo.setRemaindSeconds(0);
                HsmwPushInfo hsmwPushInfo = new HsmwPushInfo();
                hsmwPushInfo.setDataInfo(orderVehicleRequest.getId());
                hsmwPushInfo.setMessage(msg);
                hsmwPushInfo.setForemanId(orderVehicleRequest.getCreateUser());
                hsmwPushInfo.setStatus("0");
                hsmwPushInfoService.save(hsmwPushInfo);
                vo.setPushId(hsmwPushInfo.getId());
                String returnJson = JSONObject.toJSON(vo).toString();
                if(hsmwUser != null){
                    webSocket.AppointSending(hsmwUser.getUsername(),returnJson);
                    String msgs = "泵车出现问题，无法继续订单，当前暂无可用车辆，请知晓";
                    TencentPushUtils.pushForeManMsg(msgs,hsmwUser.getUsername(),"has_new_message");
                    TencentPushUtils.selfrunMsg(msgs,hsmwUser.getUsername(),"has_new_message");
                }



            }
        }
    }*/


    public HsmwReport findReportById(String reportId) {

        HsmwReport hsmwReport = hsmwReportMapper.selectById(reportId);
        List<HsmwPicture> list = hsmwPictureService.list(new LambdaQueryWrapper<HsmwPicture>().eq(HsmwPicture::getPortId, reportId));
        if (CollectionUtil.isNotEmpty(list)) {
            hsmwReport.setHsmwPictures(list);
        }
        List<HsmwReportRecord> hsmwReportRecords = hsmwReportRecordMapper.selectList(new LambdaQueryWrapper<HsmwReportRecord>().eq(HsmwReportRecord::getReportId, reportId));
        for (HsmwReportRecord hsmwReportRecord : hsmwReportRecords) {
            List<HsmwPicture> hsmwPictures = hsmwPictureService.list(new LambdaQueryWrapper<HsmwPicture>().eq(HsmwPicture::getPortId, hsmwReportRecord.getId()));
            if(CollectionUtil.isNotEmpty(hsmwPictures)){
                hsmwReportRecord.setHsmwPictures(hsmwPictures);
            }
        }
        hsmwReport.setHsmwReportRecords(hsmwReportRecords);

        HsmwDriverComplaints hsmwDriverComplaints = hsmwDriverComplaintsMapper.selectOne(new LambdaQueryWrapper<HsmwDriverComplaints>().eq(HsmwDriverComplaints::getReportId, reportId));
        hsmwReport.setHsmwDriverComplaints(hsmwDriverComplaints);
        return hsmwReport;
    }

    public DataResponse saveOrUpdateDriverComplaints(HsmwDriverComplaints hsmwDriverComplaints) {

        if(hsmwDriverComplaints == null){
            return new DataResponse(CommonConstants.ResponseStatus.FAIL,"传递参数不可为空");
        }
        if(StringUtils.isNotBlank(hsmwDriverComplaints.getId())){
            // 修改
            hsmwDriverComplaintsMapper.updateById(hsmwDriverComplaints);
        }else {
            // 新增
            if(StringUtils.isNotBlank(hsmwDriverComplaints.getSupplierId())){
                HsmwTpspUser user = hsmwTpspUserService.getById(hsmwDriverComplaints.getSupplierId());
                hsmwDriverComplaints.setSupplierName(user.getName());
                hsmwDriverComplaints.setSupplierPhone(user.getUsername());
            }
            if(StringUtils.isNotBlank(hsmwDriverComplaints.getReportId())){
                HsmwReportRecord hsmwReportRecord = hsmwReportRecordMapper.selectOne(new LambdaQueryWrapper<HsmwReportRecord>().eq(HsmwReportRecord::getReportId, hsmwDriverComplaints.getReportId()).eq(HsmwReportRecord::getReportStatus, "2"));
                if(StringUtils.equals("0",hsmwDriverComplaints.getSatisfied())){
                    hsmwReportRecord.setCloseContent("满意");
                }else {
                    hsmwReportRecord.setCloseContent("不满意");
                }
                hsmwReportRecordMapper.updateById(hsmwReportRecord);
            }

            hsmwDriverComplaintsMapper.insert(hsmwDriverComplaints);
        }
        return new DataResponse(CommonConstants.ResponseStatus.SUCCESS);
    }
}
